﻿using System;
using System.Windows.Controls;
using System.Diagnostics;

namespace StaffWarsFm.Controls
{
    /// <summary>
    /// Interaction logic for RadioPlayer.xaml
    /// </summary>
    public partial class RadioPlayer : UserControl
    {
        private string currentUserName;

        public RadioPlayer()
        {
            InitializeComponent();

            webBrowser.Navigated += webBrowser_Navigated;
        }

        void webBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            Debug.WriteLine("Finished Navigation");
        }

        public void PlayStation(string userName)
        {
            if (userName == currentUserName)
                return;

            currentUserName = userName;

            var userStatusUrl = string.Format("http://www.last.fm/listen/user/{0}/personal?autostart=1", userName);

            webBrowser.Navigate(new Uri(userStatusUrl));
        }
    }
}
